using System;
using System.Text;


namespace Framework
{
    public static class TextUtility
    {
        private static StringBuilder s_CachedStringBuilder = null;

        public static string Format(string format, params object[] args)
        {
            if (args.Length == 0)
            {
                return format;
            }
            CheckCachedStringBuilder();
            s_CachedStringBuilder.Length = 0;
            s_CachedStringBuilder.AppendFormat(format, args);
            return s_CachedStringBuilder.ToString();
        }

        private static void CheckCachedStringBuilder()
        {
            if (s_CachedStringBuilder == null)
            {
                s_CachedStringBuilder = new StringBuilder(1024);
            }
        }
    }
}